package com.flea.repository.jdbc;

import com.flea.model.Order;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author hc24
 * @date 2021.1.21 13:20
 */
@Repository
public interface OrderRepository extends PagingAndSortingRepository<Order, Integer> {

    /**
     * 分页查询卖出的订单
     *
     * @param sellerId
     * @param pageable
     * @return
     */
    List<Order> findBySellerId(Integer sellerId, Pageable pageable);

    long countBySellerId(Integer sellerId);

    /**
     * 查询自己买到的订单
     *
     * @param buyerId
     * @param pageable
     * @return
     */
    List<Order> findByBuyerId(Integer buyerId, Pageable pageable);

    long countByBuyerId(Integer buyerId);


}
